﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.IO;

namespace SystemModule
{
    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
    public class TCharDesc
    {
        public int feature;
        public int Status;
        public int Opature;
        public int Level;
        public int HP;
        public int MaxHP;

        public byte[] ToByte()
        {
            using (var memoryStream = new MemoryStream())
            {
                var backingStream = new BinaryWriter(memoryStream);
                backingStream.Write(feature);
                backingStream.Write(Status);
                backingStream.Write(Opature);

                backingStream.Write(Level);
                backingStream.Write(HP);
                backingStream.Write(MaxHP);

                var stream = backingStream.BaseStream as MemoryStream;
                return stream.ToArray();
            }
        }

    }
}
